﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>功能页面</title>
    <link rel="stylesheet" href="../../css/media.css">
    <link rel="stylesheet" href="../../css/font-style.css">
    <link rel="stylesheet" href="../../css/base.css">
    <link rel="stylesheet" href="../../css/AllBrand.css">
    <link rel="stylesheet" href="../../css/AboutBrand.css">
</head>

<body>
    <!-- 头部 -->
    <header>
        <span class="icon-arrow_lift back"></span>
        <a href="javascript:;"  class="mmm">
            <img src="../../images/header_logo.png" alt="">
        </a>
        <!-- 头部中间文字，看需求 -->
        <!-- <span>头部</span> -->
        <a href="javascript:;">
            <img src="../../images/header_app.png" alt="">
        </a>
    </header>
    <!-- 搜索栏 -->
    <div class="search">
        <input type="text" placeholder="请输入你想比价的商品" class="search_text">
        <a href="javascript:;" class="search_btn">搜索</a>
    </div>
        <!-- 全部分类 -->
        <div class="classify">
            <a href="../../index.html">首页<span class="icon-arrow-right"></span></a>
            <a href="./AllBrand.html">全部分类<span class="icon-arrow-right"></span></a>
        </div>
        <!--对应的相关品牌-->
        <div class="about_brand">
            <h3 class="about_brand_title"></h3>
        </div>
   <!-- 底部 -->
    <footer>
        <div class="foot_tool">
            <a href="javascript:;">登录</a>
            <a href="javascript:;">注册</a>
            <a href="javascript:;">返回顶部</a>
        </div>
        <div class="foot_content">
            <a href="javascript:;">手机APP下载
                <span>慢慢买手机版</span>
            </a>
            <span>--掌上比价平台</span>
            <p>m.manmanbuy.com</p>

        </div>
    </footer>
</body>
</html>
<script src="../../lib/zepto/zepto.min.js"></script>
<script src="../../lib/template/template.js"></script>
<script type="text/template" id="navListTmp">
    {{each result as val key}}
        <div class="about_brand_content">
            <a href="ProductSales.html?id={{val.brandId}}&title={{val.brandName}}">
                <span class="num">{{key + 1}}</span>
                <!-- <span class="num">{{val.brandId + 1 }}</span> -->
                <div class="brand_con">
                    <p>{{val.brandName}}</p>
                    <!-- <p>30天全网销售 ：888888件</p> -->
                    <p>{{val.brandInfo}}</p>
                </div>
                <span class="icon-arrow-right xr"></span>
            </a>
        </div>
   {{/each}}
</script>
<script type='text/javascript'>
    render();
    function render(){

        //当前URL的?号开始的字符串 
        var param = window.location.search; 
        //用正则匹配对应的id
        var id = param.match(/\d+/)[0];
        //用正则获取到title后面的的字符串
        var data = param.match(/title=(.*)/)[1];
        //将二进制的字符串转化为 中文
        var title = decodeURI(data)+'哪个牌子好';
        $.ajax({
            type:'get',
            url:'http://193.112.55.79:9090/api/getbrand',
            dataType:'json',
            data:{brandtitleid:id},
            success:function (res) {
                console.log(res);
                // 准备模板字符串
                  var htmlStr = template('navListTmp',res);
                //   动态渲染数据
                  $('.about_brand').append(htmlStr);
                // $('.about_brand_content').html(htmlStr);
                $('.about_brand_title').html(title);
            }
        })
    }
</script>
<script type="text/javascript">
     $('.back').on('click',function(){
        window.history.go(-1);
    });
</script>